<template>
	<div>
		<el-table :data="list" style="width: 100%">
			<el-table-column type="index"> </el-table-column>
			<el-table-column prop="authName" label="权限名称"> </el-table-column>
			<el-table-column prop="path" label="路径"> </el-table-column>
			<el-table-column label="权限等级">
				<template #default="scope">
					<el-tag :color="dict[scope.row.level].color">{{
						dict[scope.row.level].name
					}}</el-tag>
				</template>
			</el-table-column>
		</el-table>
	</div>
</template>

<script>
import { getRights } from '@/api/rights'
export default {
	name: 'Rights',
	data() {
		return {
			list: [],
			dict: {
				0: {
					color: 'blue',
					name: '一级',
				},
				1: {
					color: 'green',
					name: '二级',
				},
				2: {
					color: 'red',
					name: '三级',
				},
			},
		}
	},
	mounted() {
		getRights('list').then(({ data }) => {
			this.list = data.data
		})
	},
}
</script>

<style>
</style>